package com.tangyuan.user.feign;

import com.tangyuan.common.result.Result;
import com.tangyuan.feignapis.user.IUserLikeFeignClient;
import com.tangyuan.model.UserLike;
import com.tangyuan.user.service.UserLikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class UserLikeClient implements IUserLikeFeignClient {

    @Autowired
    private UserLikeService userLikeService;

    @GetMapping("/feignApi/user/selectUserLikeListByIds")
    public List<UserLike> selectUserLikeListByIds(@RequestParam(value = "ids") List<Long> ids){
        return userLikeService.selectUserLikeListByIds(ids);
    }

    @Override
    public UserLike selectUserLikeById(Long id) {
        return userLikeService.selectUserById(id);
    }

    @Override
    public int getLikeType(Long id) {
        return userLikeService.getLikeType(id);
    }

    @GetMapping("/feignApi/user/getUserLikeListByAsc")
    public List<UserLike> getUserLikeListByAsc(){
        return userLikeService.getUserLikeList();
    }

    @GetMapping("/feignApi/user/getRegisterById/{id}")
    public Result<String> getRegisterById(@PathVariable("id") int id){
        return userLikeService.register(id);
    }

    @GetMapping("/feignApi/user/getRegis")
    public Result getRegis(@RequestParam Long id){
        return userLikeService.regis(id);
    }
}
